﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mdb2RIA
{
    public class MethodGenerator
    {
        public enum MethodPrefixes
        {
            Private,
            Protected,
            Public,
            Static,
            Override
        }

        public static string GenerateMethod(string[] attributes, string methodName, string returnType, string parameters, string methodBody, params MethodPrefixes[] prefixes)
        {
            StringBuilder method = new StringBuilder();

            foreach (string attribute in attributes)
            {
                method.AppendLine(attribute);
            }

            foreach (MethodPrefixes prefix in prefixes)
            {
                method.Append(Enum.GetName(prefix.GetType(), prefix).ToLower() + " ");
            }
            
            method.Append(returnType + " ");
            method.Append(methodName);
            method.AppendLine("(" + parameters + ")");
            method.AppendLine("{");
            method.AppendLine(methodBody);
            method.AppendLine("}");

            return method.ToString();
        }
    }
}
